package com.lzm.ydpt;

import android.content.Context;

import com.byt.framlib.BuildConfig;
import com.byt.framlib.baseapp.BaseApplication;
import com.byt.framlib.commonutils.LogUtils;
import com.byt.framlib.commonutils.SharePerUtils;
import com.byt.framlib.compressorutils.CrashHandler;
import com.lzm.ydpt.entity.UserInfo;
import com.lzmpt.imchat.DemoApplication;

/**
 * app
 */
public class Dapplication extends BaseApplication {

    private static UserInfo mUserInfo;
    private  DemoApplication mDemoApplication = new DemoApplication();

    public void onCreate() {
        super.onCreate();
        LogUtils.logInit(BuildConfig.DEBUG);
        CrashHandler.create(this);
        mDemoApplication.installDemoApplication(this);
    }

    public static UserInfo getUserInfo() {
        return mUserInfo;
    }

    public static String getUserToken() {
        return SharePerUtils.getSharedString(Constants.USER_TOKEN);
    }


    public static void setUserInfo(UserInfo personalInfo) {
        Dapplication.mUserInfo = personalInfo;
    }


    public static Dapplication getApplication(Context context) {
        return (Dapplication) context.getApplicationContext();
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        mDemoApplication.attachBaseContext();
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

}